package com.clkj.xiuzheng.controller.shangcheng;

import com.clkj.xiuzheng.pojo.common.Result;
import com.clkj.xiuzheng.pojo.common.StatusCode;
import com.clkj.xiuzheng.pojo.shangcheng.ProductFactory;
import com.clkj.xiuzheng.service.shangcheng.ScLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/ScLogin")
@CrossOrigin
@Api(value = "/ScLogin", tags = {"Z商城登录"})
public class ScLoginController {

    @Autowired
    private ScLoginService scLoginService;

     @ApiOperation(value = "后台登录")
     @PostMapping("/backLogin")
     public Result backLogin(@RequestParam String userName,@RequestParam String password,@RequestParam Integer loginType)
     {
         try {
             Result result =scLoginService.getFactory(userName,password,loginType);
             return result;
         } catch (Exception e) {
             e.printStackTrace();
             return new Result(false, StatusCode.ERROR,"登录失败");
         }
     }

}
